package com.tc.objectstream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @Auther: tianchao
 * @Date: 2021/11/25 15:16
 * @Description:
 */
public class TestWrite {
    public static void main(String[] args) throws IOException {
        Student student = new Student();
        student.setAge(14);
        student.setHigh(170);
        Student left = new Student();
        left.setAge(16);
        left.setHigh(180);
        student.setLeft(left);
        String path = System.getProperty("user.dir");
        System.out.println(path);
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path+"/objectstream/testObj"));
        oos.writeObject(student);
        oos.close();
    }
}
